<template>
  <el-form :model="form" label-width="120px">
    <el-form-item label="部门名称">
      <el-input v-model="form.department" />
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="save" style="width: 100%">保存</el-button>
    </el-form-item>
  </el-form>
</template>

<script lang="ts" setup>
import { ref, reactive, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import { useRouter } from 'vue-router'
const router = useRouter()
const form = reactive({
  department: ''
})

onMounted(async() => {
  let system_prop = localStorage.getItem('system_prop')
  if(system_prop){
    const data = JSON.parse(system_prop)
    Object.assign(form, data)
  }
})

async function save() {
    localStorage.setItem('system_prop',JSON.stringify(form))
    ElMessage.success('保存成功！')
    window.location.reload()
}
</script>

<style lang="scss" scoped></style>
